<div id="soc_box_js">
    <ul id="soc_box_main" class="soc_ul">
        <li class="soc_box_main_top">Danh Mục</li>
        <li class="soc_linull">
            <a href="<?php echo TreTodayUrl::home() ?>" id="soc_box_1" class="span_top_js">Trang chính</a>
        </li>
        <?php foreach ($catalogs as $catalog) {
            ?>
            <li class="soc_li <?php echo ($catalog['id'] == $id || (isset($catalog['child_ids']) && in_array($id, $catalog['child_ids']))) ? "soc_box_js_act" : "" ?>">
                <a data-id="<?php echo $catalog['id'] ?>"
                   href="<?php echo TreTodayUrl::getCategoryUrl($catalog['id'], $catalog['name']); ?>"
                   id="soc_box_2" class="span_top_js"> <?php echo $catalog['name'] ?></a>
                <?php if (isset($catalog['childs'])) {
                    if (in_array($id, $catalog['child_ids'])) {
                        ?>
                        <div class="soc_menu_content">
                            <ul>
                                <?php foreach ($catalog['childs'] as $item) { ?>
                                    <li <?php echo $item['id'] == $id ? 'class="active_menu_main"' : '' ?>>
                                        <a href="<?php echo TreTodayUrl::getCategoryUrl($item['id'], $item['name']) ?>"
                                           rel="s<?php echo $item['id'] ?>"><?php echo $item['name'] ?></a>
                                    </li>
                                <?php } ?>
                            </ul>
                        </div>

                    <?php } else { ?>
                    <div class="soc_menu_content" <?php echo ($catalog['id'] != $id) ? 'style="display:none"' : "" ?> >
                        <ul>
                            <?php foreach ($catalog['childs'] as $item) { ?>
                                <li>
                                    <a href="<?php echo TreTodayUrl::getCategoryUrl($item['id'], $item['name']) ?>"
                                       rel="s<?php echo $item['id'] ?>"><?php echo $item['name'] ?></a>
                                </li>
                            <?php } ?>
                        </ul>
                        </div><?php } ?>
                <?php } ?>
            </li>
        <?php } ?>
    </ul>
</div>